package io.renren.modules.monitor.controller;

import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.Result;
import io.renren.modules.monitor.dto.MonitorDeviceDTO;
import io.renren.modules.monitor.service.MonitorDeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/monitor/device")
@Api(tags = "预设设备id集")
@AllArgsConstructor
public class MonitorDeviceController {

    private final MonitorDeviceService monitorDeviceService;
    /**
     * 监控设备信息获取
     * @param params
     * @return
     */
    @GetMapping("page")
    @ApiOperation("分页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = Constant.PAGE, value = "当前页码，从1开始", paramType = "query", required = true, dataType = "int"),
            @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int")
    })
    public Result<PageData<MonitorDeviceDTO>> page(@RequestParam Map<String, Object> params) {
        PageData<MonitorDeviceDTO> page = monitorDeviceService.page(params);
        return new Result<PageData<MonitorDeviceDTO>>().ok(page);
    }
}
